package model;

import java.awt.Rectangle;
import java.util.Calendar;

/**
 * 08-01-10
 * 
 * This holds all the information for an appointment.
 * 
 * @author Maarten Ezedam & Dave Nieuwenhuijzen
 */
public class AppointmentDataModel {
	private int id;
	private String title;
	private Calendar startDate;
	private Calendar endDate;
	private String location;
	private String contact;
	private CategoryDataModel category;
	private String description;
	private Rectangle bounds;

	/**
	 * The AppointmentDataModel constructor
	 * 
	 * @param newId The id of the appointment
	 * @param newStartDate The start date of the appointment
	 * @param newEndDate The end date of the appointment
	 * @param newLocation The location of the appointment
	 * @param newContact The contact for the appointment
	 * @param newDescription The description for the appointment
	 */
	public AppointmentDataModel(int newId, String newTitle, Calendar newStartDate, Calendar newEndDate, String newLocation, String newContact, CategoryDataModel newCategory, String newDescription) {
		id = newId;
		title = newTitle;
		startDate = newStartDate;
		endDate = newEndDate;
		contact = newContact;
		location = newLocation;
		category = newCategory;
		description = newDescription;
	}

	/**
	 * Return the id of the appointment
	 * 
	 * @return id;
	 */
	public int getId() {
		return id;
	}

	/**
	 * Return the title of the appointment
	 * 
	 * @return id;
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * Return the start date of the appointment
	 * 
	 * @return Calendar;
	 */
	public Calendar getStartDate() {
		return startDate;
	}

	/**
	 * Return the end date of the appointment
	 * 
	 * @return Calendar;
	 */
	public Calendar getEndDate() {
		return endDate;
	}

	/**
	 * Return the location of the appointment
	 * 
	 * @return String;
	 */
	public String getLocation() {
		return location;
	}

	/**
	 * Return the contact of the appointment
	 * 
	 * @return String;
	 */
	public String getContact() {
		return contact;
	}

	/**
	 * Return the category of the appointment
	 * 
	 * @return CategoryDataModel
	 */
	public CategoryDataModel getCategory() {
		return category;
	}

	/**
	 * Return the description of the appointment
	 * 
	 * @return String;
	 */
	public String getDescription() {
		if(description == null) {
			return "";
		} else {
			return description;
		}
	}
	
	/**
	 * Gets the rectangle how the appointment should be shown in the calendar content view
	 * 
	 * @return An instance of Rectangle with the X, Y, Width and Height set
	 */
	public Rectangle getBounds() {
		return bounds;
	}
	
	/**
	 * Sets the rectangle how the appointment should be shown in the calendar content view
	 * 
	 * @param setBounds
	 */
	public void setBounds(Rectangle setBounds) {
		bounds = setBounds;
	}

	/**
	 * Returns the title of the appointment
	 * 
	 * @return String
	 */
	public String toString() {
		return title;
	}
}